﻿using System;
using System.Collections.Generic;
using Dragon.Library.Framework.Interface.Bo;

namespace Dragon.Library.Framework.Bo
{
    public sealed class BoTran
    {
        private readonly IList<IBaseBo> _baseBo;
        private readonly string _seesionKey;

        public BoTran()
        {
            _baseBo = new List<IBaseBo>();
            _seesionKey = Guid.NewGuid().ToString();
        }

        public void Add(IBaseBo baseBo)
        {
            baseBo.StartTran(_seesionKey);
            _baseBo.Add(baseBo);
        }

        public void Flush()
        {
            _baseBo[0].Flush();
        }
    }
}
